package com.ruoyi.order.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.order.domain.TechnicianBellItemOrder;
import com.ruoyi.order.service.ITechnicianBellItemOrderService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 加钟订单Controller
 * 
 * @author ruoyi
 * @date 2025-04-09
 */
@RestController
@RequestMapping("/technicianBellItemOrder/technicianBellItemOrder")
public class TechnicianBellItemOrderController extends BaseController
{
    @Autowired
    private ITechnicianBellItemOrderService technicianBellItemOrderService;

    /**
     * 查询加钟订单列表
     */
    @PreAuthorize("@ss.hasPermi('technicianBellItemOrder:technicianBellItemOrder:list')")
    @GetMapping("/list")
    public TableDataInfo list(TechnicianBellItemOrder technicianBellItemOrder)
    {
        startPage();
        List<TechnicianBellItemOrder> list = technicianBellItemOrderService.selectTechnicianBellItemOrderList(technicianBellItemOrder);
        return getDataTable(list);
    }

    /**
     * 导出加钟订单列表
     */
    @PreAuthorize("@ss.hasPermi('technicianBellItemOrder:technicianBellItemOrder:export')")
    @Log(title = "加钟订单", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TechnicianBellItemOrder technicianBellItemOrder)
    {
        List<TechnicianBellItemOrder> list = technicianBellItemOrderService.selectTechnicianBellItemOrderList(technicianBellItemOrder);
        ExcelUtil<TechnicianBellItemOrder> util = new ExcelUtil<TechnicianBellItemOrder>(TechnicianBellItemOrder.class);
        util.exportExcel(response, list, "加钟订单数据");
    }

    /**
     * 获取加钟订单详细信息
     */
    @PreAuthorize("@ss.hasPermi('technicianBellItemOrder:technicianBellItemOrder:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(technicianBellItemOrderService.selectTechnicianBellItemOrderById(id));
    }

    /**
     * 新增加钟订单
     */
    @PreAuthorize("@ss.hasPermi('technicianBellItemOrder:technicianBellItemOrder:add')")
    @Log(title = "加钟订单", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TechnicianBellItemOrder technicianBellItemOrder)
    {
        return toAjax(technicianBellItemOrderService.insertTechnicianBellItemOrder(technicianBellItemOrder));
    }

    /**
     * 修改加钟订单
     */
    @PreAuthorize("@ss.hasPermi('technicianBellItemOrder:technicianBellItemOrder:edit')")
    @Log(title = "加钟订单", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TechnicianBellItemOrder technicianBellItemOrder)
    {
        return toAjax(technicianBellItemOrderService.updateTechnicianBellItemOrder(technicianBellItemOrder));
    }

    /**
     * 删除加钟订单
     */
    @PreAuthorize("@ss.hasPermi('technicianBellItemOrder:technicianBellItemOrder:remove')")
    @Log(title = "加钟订单", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(technicianBellItemOrderService.deleteTechnicianBellItemOrderByIds(ids));
    }
}
